<%@ page language="java" import="java.util.*, model.*" pageEncoding="ISO-8859-1"%>

<%@page import="bean.PollUser"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String title = "Home";
	
	ArrayList al = new ArrayList();
	al = PCmasterImpl.showPollMaster();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>   
    <title>My JSP 'index.jsp' starting page</title>
  </head>
  
  <body>
    <div class='clearboth'></div>
			<div id="goods">
			 <table border="1" Width="100%" cellpadding="0" cellspacing="0" color="red" >
				<thead>
				<tr id="row1" align="left">
				<th>Username</th>
				<th>Password</th>
				<th>Email</th>
				<th>Firstname</th>
				<th>Lastname</th>
				<th>CreateDate</th>
				</tr>
				</thead>
				
				
				<tbody>
				
				<%for (int i = 0; i < al.size(); i++) {
				PollUser pb = (PollUser) al.get(i);
								%>
				<form name = "aa" action = "DeleteMasterServlet" method="post">	
				<tr id= <%=pb.getUsername()%>>		
				<td><a href='Question.jsp?id=<%=pb.getUsername()%>'><%=pb.getUsername()%></a></td>
				<td style="display:none"><input type = "text" name = "pmusername" id = "pmusername" value = "<%=pb.getUsername()%>"></input></td>
				<td><%=pb.getPassword()%></td>
				<td><%=pb.getEmail()%></td>	
				<td><%=pb.getFirstname()%></td>
				<td><%=pb.getLastname()%></td>
				<td><%=pb.getCreateDate()%></td>				
				<td><input type=submit value=Delete /></td>
				</tr>
				</form>
				<%
					}

						
				%>
				<hr />
				 <form name = "bb" action = "AddMasterServlet" method="post">
				 <tr id= adduser>
			
				<td><input type = "text" name = "pmusername" id = "pmusername" ></input></td>
				<td><input type = "text" name = "pmpassword" id = "pmpassword" ></input></td>
				<td><input type = "text" name = "pmemail" id = "pmemail" ></input></td>
				<td><input type = "text" name = "pmfn" id = "pmfn" ></input></td>
				<td><input type = "text" name = "pmln" id = "pmln" ></input></td>
				<td><input type=submit value=Add /></td>	
				</tr>
				</form>
				</tbody>
			</table> 		
		</div >		
	</body>
</html>